using Engine;
using Game;
using GameEntitySystem;

namespace SCIENEW {
    /// <summary>
    /// 机器特殊值三位，前两位是机器朝向，后一位是机器是否为亮着的
    /// </summary>
    public class SifterDevice : FourDirectionModelDevice, ICrafterDevice<ComponentSifter>, IElectricElementDevice {
        public SifterDevice() : base("SifterDevice", "Models/Sifter", "Sifter") { }

        public override bool IsFaceTransparent(SubsystemTerrain subsystemTerrain, int face, int value) => true;

        public override bool IsTransparent_(int value) => true;

        public override string GetSoundMaterialName(SubsystemTerrain subsystemTerrain, int value) => "Wood";

        public override int GetFaceTextureSlot(int face, int value) => 186;

        public string GetEntityName(int value) => "Sifter";

        public Widget GetWidget(IInventory inventory, ComponentSifter component) => null;

        public override DeviceBehavior[] GetBehaviors(Project project) => [new SifterDeviceBehavior(project)];

        public override int GetShadowStrength(int value) => 0;

        public override int GetDisplayOrder(int value) => base.GetDisplayOrder(value) - 1;

        public ElectricElement CreateElectricElement(SubsystemElectricity subsystemElectricity, int value, int x, int y, int z) => new CrafterPopResultsElectricElement(subsystemElectricity, new Point3(x, y, z), GetDirection(value));

        public ElectricConnectorType? GetConnectorType(SubsystemTerrain terrain, int value, int face, int connectorFace, int x, int y, int z) => ElectricConnectorType.Input;

        public int GetConnectionMask(int value) => int.MaxValue;
    }
}